package com.atguigu.gmall.item.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author XIN
 * 2023/4/25
 */
@RestController
@RequestMapping("/api/item")
public class ItemController {
@Autowired
	private ItemService itemService;
	/**
	 * 查询商品信息,汇总详情页面需要数据,远程调用商品微服务，根据skuid汇总sku商品详情页所有数据
	 *
	 * @param skuId
	 * @return
	 */
	@GetMapping("/{skuId}")
	public Result getItemInfo(@PathVariable Long skuId) {
		Map<String,Object> map = itemService.getItemInfo(skuId);
		return Result.ok(map);
	}
}
